home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Utilities / XCMD's⁄XFCN's / GetVolume⁄SetVolume / GetPVolume.Pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-02-27  |  1.3 KB  |  57 lines  |  [TEXT/ttxt]

  1. {$R-}
  2. {
  3.     GetPVolume -- An HyperCard XFCN that will return the volume of the speaker
  4.                     as it is stored in the parameter RAM.
  5.     
  6.         Written by Steven Kienle, CIS account number 72330,111
  7.     
  8.     GetPVolume should be called in HyperCard as
  9.         GetPVolume()
  10.     The parentheses are required.
  11.     
  12.     After compiling this program, link it with the GetPVolume.Link, then use
  13.     ResEdit to move the XFCN resource to the appropriate stack.  Or use the
  14.     GetPVolume/SetVolume stack's Install button.
  15.     
  16.     NOTE:  for the XCmdGlue.inc file to work with TML Pascal, a few 
  17.            modifications are required.
  18. }
  19.  
  20. {$S GetPVolume }     { Segment name must be the same as the command name. }
  21.  
  22. UNIT DummyUnit;
  23.  
  24. INTERFACE
  25.  
  26. USES MacIntf, HyperXCmd;
  27.  
  28. PROCEDURE ENTRYPOINT(paramPtr: XCmdPtr);
  29.     
  30. IMPLEMENTATION
  31.  
  32. PROCEDURE GetPVolume(paramPtr: XCmdPtr); FORWARD;
  33.  
  34.   PROCEDURE ENTRYPOINT(paramPtr: XCmdPtr);
  35.   BEGIN
  36.     GetPVolume(paramPtr);
  37.   END;
  38.  
  39. PROCEDURE GetPVolume(paramPtr: XCmdPtr);
  40.     VAR
  41.         loldVolume : LongInt ;
  42.         pasStr : Str255 ;
  43.         theParams : SysPPtr ;
  44.  
  45.     {$I XCmdGlue.inc }
  46.  
  47.     BEGIN
  48.         theParams := GetSysPPtr ;    { Get the volume from the Parameter RAM }
  49.         loldVolume := BitAnd(theParams^.volClik,$0700) DIV $0100 ;
  50.         pasStr := NumToStr(loldVolume) ;                { Convert number to string }
  51.         paramPtr^.returnValue := PasToZero(pasStr) ;    { Return the value }
  52.     END;
  53.  
  54.  
  55. END.
  56.  
  57.